package com.liy.framework.common.vo;

import com.liy.framework.common.utils.ContextHandler;
import com.liy.framework.common.utils.DateUtil;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;

import java.util.Date;

@JsonIgnoreProperties({"language", "tempField"})
public class BaseVO<PK> extends SupportVO<PK> {

    private static final long serialVersionUID = 1L;
    private String createBy;
    private String createDate;
    private String lastUpdateBy;
    private String lastUpdateDate;

    public BaseVO() {
        this.init();
    }

    public BaseVO(Boolean initFlag) {
        if (initFlag) {
            this.init();
        }

    }

    public void init() {
        this.setCreateBy(ContextHandler.getUserID());
        this.setLastUpdateBy(ContextHandler.getUserID());
        this.setCreateDate(DateUtil.dateToStrLong(new Date()));
        this.setLastUpdateDate(this.getCreateDate());
    }

    public String getCreateBy() {
        return this.createBy;
    }

    public void setCreateBy(String createBy) {
        this.createBy = createBy;
    }

    public String getCreateDate() {
        return this.createDate;
    }

    public void setCreateDate(String createDate) {
        this.createDate = createDate;
    }

    public String getLastUpdateBy() {
        return this.lastUpdateBy;
    }

    public void setLastUpdateBy(String lastUpdateBy) {
        this.lastUpdateBy = lastUpdateBy;
    }

    public String getLastUpdateDate() {
        return this.lastUpdateDate;
    }

    public void setLastUpdateDate(String lastUpdateDate) {
        this.lastUpdateDate = lastUpdateDate;
    }
}
